const sumFibs = num => {
  const fibs = [0, 1];
  let sum = 1;
  let next = 1;
  while (next <= num) {
    fibs.push(next);
    if (next % 2) sum += next;
    next = fibs[fibs.length - 1] + fibs[fibs.length - 2]
  }
  return sum;
}


let output = sumFibs(1000);
console.log(output);